<!DOCTYPE html>
<%@page import="com.doeis.common.Constant"%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title><%=Constant.LOTTERY_PROJECT_TITLE%></title>
<%@include file="/WEB-INF/page/common/import.jsp"%>

<link rel="stylesheet" href="/static/css/login.css" />
</head>
<body>
	<div class="container">

		<form class="form-signin" method="post" action="" onsubmit="return false;">
			<h3 class="form-signin-heading">修改个人信息</h3>
			<input type="text" class="input-block-level" value="${user.username}" disabled> <input type="password"
				class="input-block-level" name="new_password" id="new_password" placeholder="新密码，若不修改请留空"> <input type="password"
				class="input-block-level" name="password" id="password" placeholder="原密码，若不修改密码请留空">
			<button id="submit_btn" class="btn  btn-primary" type="button">提交</button>
			<a href="javascript:history.go(-1)" class="btn">返回</a>
		</form>

	</div>
	<script type="text/javascript">
	$(function() {
		$("#submit_btn").click(function(){
			var new_password = $("#new_password").val();
			var password = $("#password").val();
			if(password==null||password.length==0){
				alert("原密码不能为空");return;
			}
			if(new_password==null||new_password.length==0){
				alert("新密码不能为空");return;
			}
			$.post("doSetting", {
		  		"new_password" : new_password,
		  		"password" : password
		  	}, function(data) {
		  		if (data.status) {
		  			alert("修改成功！");
		  			window.location.href = "/item";
		  		} else {
		  			alert(data.msg);
		  		}
		  	}, "json");
		});
	});
	</script>
</body>
</html>